package company.pingduoduo;

import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

/**
 * 拼多多编程题1
 *
 * @author briarbear
 * @blog https://briarbear.github.io
 * @date 2018-08-30 19:18
 */
public class P01 {

    public static void main(String[] args) {


        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();

            HashMap<Integer, Integer> map = new HashMap<>();
            int rest = a % b;
            int index = 0;
            map.put(index,rest);
            int len = 0;
            int i = 0;
            while (rest != 0){
                rest *= 10;
                rest %= b;
                if (map.containsKey(rest)){
                    len = i - map.get(rest);
                    break;
                }else
                    map.put(rest,i);
                i++;
            }
            if (rest == 0) System.out.println(i+1+ " "+0);
            else System.out.println(map.get(rest) + " " + len);
        }
    }


    public static void helper(String str,int[] res){

    }
}
